return g_task_propagate_pointer (G_TASK (result), error);
}
-/**
- * gdk_drop_read_text_async:
- * @self: a #GdkDrop
- * @cancellable: (nullable): optional #GCancellable object, %NULL to ignore.
- * @callback: (scope async): callback to call when the request is satisfied
- * @user_data: (closure): the data to pass to callback function
- *
- * Asynchronously request the drag operation's contents converted to a string.
- * When the operation is finished @callback will be called. You can then
- * call gdk_drop_read_text_finish() to get the result.
- *
- * This is a simple wrapper around gdk_drop_read_value_async(). Use
- * that function or gdk_drop_read_async() directly if you need more
- * control over the operation.
- **/
-void
-gdk_drop_read_text_async (GdkDrop *self,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- g_return_if_fail (GDK_IS_DROP (self));
- g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
- g_return_if_fail (callback != NULL);
-
- gdk_drop_read_value_internal (self,
- G_TYPE_STRING,
- gdk_drop_read_text_async,
- G_PRIORITY_DEFAULT,
- cancellable,
- callback,
- user_data);
-}
-
-/**
- * gdk_drop_read_text_finish:
- * @self: a #GdkDrop
- * @result: a #GAsyncResult
- * @error: a #GError location to store the error occurring, or %NULL to
- * ignore.
- *
- * Finishes an asynchronous read started with
- * gdk_drop_read_text_async().
- *
- * Returns: (transfer full) (nullable): a new string or %NULL on error.
- **/
-char *
-gdk_drop_read_text_finish (GdkDrop *self,
- GAsyncResult *result,
- GError **error)
-{
- const GValue *value;
-
- g_return_val_if_fail (g_task_is_valid (result, self), NULL);
- g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drop_read_text_async, NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
- value = g_task_propagate_pointer (G_TASK (result), error);
- if (!value)
- return NULL;
-
- return g_value_dup_string (value);
-}
-
static void
gdk_drop_do_emit_event (GdkEvent *event,
gboolean dont_queue)
gdk_drop_do_emit_event (event, dont_queue);
}
-/**
- * gdk_drop_has_value:
- * @self: a #GdkDrop
- * @type: the type to check
- *
- * Returns whether calling gdk_drop_read_value_async() for @type
- * can succeed.
- *
- * Returns: %TRUE if the data can be deserialized to the given type
- */
-gboolean
-gdk_drop_has_value (GdkDrop *self,
- GType type)
-{
- GdkContentFormats *formats;
- gboolean ret;
-
- formats = gdk_content_formats_ref (gdk_drop_get_formats (self));
- formats = gdk_content_formats_union_deserialize_gtypes (formats);
-
- ret = gdk_content_formats_contain_gtype (formats, type);
-
- gdk_content_formats_unref (formats);
-
- return ret;
-}
-